package org.example.base.stream;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.function.IntBinaryOperator;
import java.util.function.IntConsumer;
import java.util.function.Predicate;

public class StreamTest {
    public static void main(String[] args) {
        int[] a = {1, 2, 3};
        Arrays.stream(a).filter(e -> e > 2).forEach(System.out::println);
        Arrays.stream(a).peek(value -> System.out.println("value = " + value)).forEach(System.out::println);
        OptionalInt reduce = Arrays.stream(a).reduce(new IntBinaryOperator() {
            @Override
            public int applyAsInt(int left, int right) {
                return left + right;
            }
        });


    }
}
